package odgs.message.server;

import odgs.Connection;
import odgs.Contents;
import odgs.ExplorerNode;
import odgs.Transaction;
import odgs.message.Message;
import odgs.message.MessageHandler;
import odgs.message.MessageProcessor;
import odgs.transaction.ContentsAddTransaction;

public class TransactionCancelRequestHandler implements MessageHandler
{
	public void execute(MessageProcessor processor, Message msg, Connection con)
	{
		Transaction tran = (Transaction) msg.get("transaction");
		if (tran instanceof ContentsAddTransaction)
		{
			ContentsAddTransaction trans = (ContentsAddTransaction) tran;
			Contents cont = trans.getSource();
			ExplorerNode node = processor.getServerManager().getExplorerNode(cont);
			if(node != null)
			{
				processor.getServerManager().removeContents(node.getUid());
			}
		}
	}
}